#include "myread.h"

static void     clear(char    s[])
{
    int         len = 0;

    len = mystrlen(s);
    for (int i = 0; i < len; i++)
        s[i] = '\0';
}

static void		readi(char	buf[])
{
    while (read(STDIN_FILENO, buf, 2048))
            {
                    if (mystrcmp(buf, "help\n") == 1)
                    {
                        help();
                        clear(buf);
                    }
					else if (mystrcmp(buf, "quit\n") == 1)
							return ;
						else
							error(2, buf);
			}
}
int     main(int    argc,
             char   **argv)
{
    char    buf[2048] = {'\0'};
    argc = argc;
    argv = argv;

	if (argc < 2)
	{
		error(1, NULL);
		return (1);
	}
	else
	{
		clear(buf);
        while (1)
        {
            write(STDOUT_FILENO, "> ", 2);
			readi(buf);
        }
        test_iso(argv[1]);
        return 0;
	}
}
